#######################
# This creates Figure 6, comparing results of question wording experiment 2
#######################

##Find mean support for personal involvement in use of force, unconditional on question wording
force.plot2<-svymean(~itf,nd)

#format line with sort order (3), mean, se supporting use of force
line1b<-c(3,force.plot2,SE(force.plot2))

#find mean support for use of force, conditional on question wording
line2b<-svyby(~itf,~p_over,nd,svymean)

#bind these results together
fig7<-rbind(line2b,line1b)

##calculate 95% confidence intervals
fig7$ci_lo<-(fig7$itf-(1.96*fig7$se))
fig7$ci_hi<-(fig7$itf+(1.96*fig7$se))

#create plot of means, confidence intervals
#Note - this converts raw values to percentage by multiplying by 100
fig7plot <- ggplot(fig7, aes(x = as.factor(p_over), y=itf*100,color=as.factor(p_over),shape=as.factor(p_over)))+
  ylim(0,10)+
  geom_point(size = 2) + 
  theme_bw()+
  theme(legend.position="none")+
  theme(axis.title.x=element_blank(),axis.title.y=element_blank())+
  theme(plot.title = element_text(hjust = 0.5))+
  geom_linerange(aes(ymin = ci_lo*100, ymax = ci_hi*100))+
  scale_x_discrete(labels=c("Even If People Are Hurt or Killed","No Consequences","All Respondents")) +
  ggtitle("% Agree or Strongly Agree \nI would participate in the use of force\n to restore Donald Trump to the presidency,")

plot(fig7plot)

#save results as  tiff
ggsave("../Main Results/Fig7.tif", width=6, height=4, units = "in",dpi=600)


